/*
 * 逆序数的拆分计算（3分）
 */

#include <stdio.h>
#include <math.h>

int main() {
	setbuf(stdout, NULL);

	int input, digit_buffer[4];

	printf("Input x:\n");
	scanf("%d", &input);

	input = abs(input);

	for (int i = 3; i >= 0; --i) {
		digit_buffer[i] = input % 10;
		input /= 10;
	}

	printf("y=");
	for (int i = 3; i >= 0; --i) {
		printf("%d",digit_buffer[i]);
	}
	printf("\n");

	printf("a=%d,b=%d\n",
	       digit_buffer[3] * 10 + digit_buffer[2],
	       digit_buffer[1] * 10 + digit_buffer[0]);
	printf("result=%d\n",
	       (digit_buffer[3] * 10 + digit_buffer[2]) * (digit_buffer[3] * 10 + digit_buffer[2]) +
	       (digit_buffer[1] * 10 + digit_buffer[0]) * (digit_buffer[1] * 10 + digit_buffer[0])
	);

	return 0;
}